Skip to main content

Getting Pairs

getPairs​

Returns the pairs supported on a given Blockchain, and optionally with a given Scheme.

Usage​

import { getPairs } from '@chronicleprotocol/pull-oracle';

const pairs = await getPairs({ blockchain });

Returns​

Returns a promise that provides the Blockchain, Scheme, and a Pairs object.

interface PairData {
blockchain: Blockchain,
scheme: Scheme,
pairs: {
[pair: string]: {
bar: number,
validators: Address[]
},
...
}
}

Example​

{
blockchain: "ETH",
scheme: "ECDSA",
pairs: {
"BTC/USD": {
bar: 13,
validators: [
"0xabc123...",
"0xabc123...",
"0xabc123...",
...
]
},
"ETH/USD": {
bar: 13,
validators: [
"0xabc123...",
"0xabc123...",
"0xabc123...",
...
]
},
...
}
}

Parameters​

blockchain​

A blockhain identifier indicating on which chain the pairs are going to be used.

scheme​

  • Optional
  • Type: Scheme
  • Default: ECDSA

The encryption scheme used for price messages of these pairs

Errors​

In the event of an error, the return object will be an APIResponseError.

Example​

{
error: true,
message: `VADER blockchain not supported`,
data: {
scheme: "ECDSA",
blockchain: "VADER"
},
code: APIErrorCode.BLOCKCHAIN_NOT_SUPPORTED
}